package utils

type ListNode struct {
	Val    int
	Next   *ListNode
	Random *ListNode
}

type DLinkedNode struct {
	Key, Value int
	Prev, Next *DLinkedNode
}

func GetListNodeByArray(nums []int) *ListNode {
	if len(nums) == 0 {
		return nil
	}
	rootNode := &ListNode{
		Val:  nums[0],
		Next: nil,
	}

	nodePoint := rootNode

	for i := 1; i < len(nums); i++ {
		currNode := &ListNode{
			Val:  nums[i],
			Next: nil,
		}
		nodePoint.Next = currNode
		nodePoint = nodePoint.Next
	}
	return rootNode
}
